<!--
 * @Author       : xiaowu wwl093000@163.com
 * @Date         : 2023-07-04 08:12:13
 * @LastEditTime : 2023-08-01 13:54:26
 * @LastEditors  : xiaowu wwl093000@163.com
 * @FilePath     : /erp-admin-ui/src/views/notice/picture-detail.vue
 * @Description  : -
-->
<template>
  <div class="app-container" v-loading="loading">
    <h2 class="container-title">{{ form.title }}</h2>
    <p class="container-time">{{ form.createTime }}</p>
    <div class="align-centerBox">
      <div class="container-content" v-html="form.content"></div>
      <div class="container-url">
        附件：
        <a :href="form.url">{{ form.urlTilte }}</a>
      </div>
    </div>
  </div>
</template>

<script>
import { detail } from "@/api/notice/picture";
import store from '@/store';
import FileUpload from '@/components/FileUpload';
export default {
  name: "PictureDetail",
  components: {
    FileUpload
  },
  data() {
    return {
      loading: false,
      form: {}
    };
  },
  created() {
    if (this.$route.params.id) this.detailFn(this.$route.params.id);
  },
  methods: {
    detailFn(id) {
      this.loading = true;
      detail(id).then(response => {
        this.loading = false;
        var url = response.data.url;
        if (url) {
          if (url.indexOf('http://') === -1 && url.indexOf('https://') === -1) url = store.getters.domain + url
        }
        this.form = response.data;
        this.$set(this.form, 'urlTilte', response.data.url);
        this.$set(this.form, 'url', url);
      });
    },
  }
};
</script>

<style lang="scss">
.app-container {
  .container-title {
    text-align: center;
    margin: 0;
    padding: 30px 0 0;
  }
  .container-time {
    text-align: center;
    padding: 10px;
  }
  .container-url {
    font-size: 14px;
    color: rgb(64, 158, 255);
  }
  .align-centerBox {
    width: 60%;
    margin: 0 auto;
  }
}
</style>